<?php
//var_dump($_SESSION);
//echo($_SESSION['admin']['username']);
//exit;
/**
 * 内容管理视图
 *
 *
 *
 */
// 保存数据框架名
$save_frame = $_SESSION[$G_admin_session_key]['save_frame'];
$back_url   = get_current_url();
// 将当前URL保存在Cookie中，避免复杂的URL字符串
cookie('back_url', strcode($back_url));
$url_cur    = get_current_url(array('orderby', 'desc'));
// 排序
$orderlist  = array('aid', 'cid', 'article_title', 'pub_time', 'createtime', 'display','flag_1','flag_2','flag_8','zoneid');
$arr_orderby= parse_orderby($orderlist, 'uid', $url_cur);


/**
 * 搜索参数处理
 *
 */
// 关键字
$key        = trim(@$_GET['key']);
// 是否包含子类
$cid    = @(int)$_GET['cid'];
$sub    = @(int)$_GET['sub'];
$chk_sub= $sub == 1 ? ' checked' : '';



// 是否显示
$display        = @(int)$_GET['display'];
$chk_display_all= '';
$chk_display_2  = '';
$chk_display_1  = '';
if($display == 2) {
    $chk_display_2  = ' checked';
} elseif($display == 1) {
    $chk_display_1  = ' checked';
} else {
    $chk_display_all= ' checked';
}

$is_ad      = @(int)$_GET['is_ad'];
$begin_date = @$_GET['begin_date'];
$end_date   = @$_GET['end_date'];

$flag       = 0;
if(!empty($_GET['flag']) && is_array($_GET['flag'])) {
    foreach($_GET['flag'] as $f) {
        $flag += @(int)$f;
    }
}
if($cata_info['cata_type'] == 11){
$cata_keylang='通知';
}

$dsp_ad     = ($is_ad == 1) ? 'style="display:block"':'style="display:none"';
$chk_top        = @(int)$_GET['top'] == 1 ? ' checked':'';



// 预览地址
if($cata_info['cata_dir'] != '') {
    $preview    = $cata_info['cata_type'] == 1 ? '../' . $cata_info['cata_dir'] . '/index.php' : '../' . $cata_info['cata_dir'] . '/display.php';
} else {
    $preview    = '../news/display.php';
}


// + -------------------------------------- + //
// 排序处理 - 为排序加上小图标

$order_by   = @trim($_GET['orderby']);
$order_desc = @(int)$_GET['desc'];

if($order_by != '') {
    $order_desc = ($order_desc!=1) ? 'sort_asc' : 'sort_desc' ;
    $this_param_style  = $order_by . '_style';
    $$this_param_style = '<div class="' . $order_desc . '"></div>';
}

// + -------------------------------------- + //

require($abs_admin_cppath . '/header.php');

?>

<SCRIPT LANGUAGE="JavaScript" SRC="<?php echo $url_global['common'] ?>/js/popcalendar.js"></SCRIPT>
<div class="datacontainer1" id="listDiv">

<TABLE BORDER="0" CELLPADDING="4" CELLSPACING="1" width="100%" class="list_table">
<THEAD>
	<TR class="list_head">
		<TH scope=col width="30" class="textC"><a href="<?php echo $arr_orderby['aid']; ?>"><?php echo $aid_style;?>#</a></TH>
		<TH scope=col width="540" class="textL"><a href="<?php echo $arr_orderby['article_title']; ?>"><?php echo $article_title_style;?><?php echo $cata_keylang; ?>标题</a></TH>
		
		<TH scope=col width="80">操作</TH></TR></THEAD>
<TBODY>
<?php
$tr_class   = '';
if(!empty($viewvar['record']) && sizeof($viewvar['record']) > 0) {
    foreach($viewvar['record'] as $k=>$v) {
        $tr_class   = $tr_class != 'tr0' ? 'tr0' : 'tr1';
        $aid    = $v['aid'];
        $cid    = $v['cid'];

        $article_title  = $v['article_title'];
        $class_info     = get_node_info($$class_var, $cid);
        $class_name     = $class_info['cname'];

        $pub_time       = $v['pub_time'];
        $pub_realname  = $v['pub_realname'];

        $createdtime    = @(int)$v['createdtime'];
        $pub_time       = date(DATE_FORMAT, $pub_time);


        $class_path      = tree_node_path_text($class_info['__node_path']);


        // 数据库中没有管html和php代码，这里过滤
        $article_title  = htmlspecialchars($article_title);
        $class_name     = htmlspecialchars($class_name);
        $pub_realname   = htmlspecialchars($pub_realname);

        $small_image  = $G_web_root . '/uploads/' . $v['small_image'];

        $article_title_cut  = zh_substr($article_title, 50);
        $class_name_cut     = zh_substr($class_name, 15);
        if($v['display'] == 1) {
            $txt_display    = "<div class=\"btn_yes\" onclick=\"listTable.toggle(this, 'display', 1, '$aid')\">{$v['display']}</div>";//"<font style=\"color:#336600\">√</font>";
            //$txt_check      = '审';
        } else {
            $txt_display    = "<div class=\"btn_no\" onclick=\"listTable.toggle(this, 'display', 1, '$aid')\">0</div>";//"<font style=\"color:red\">×</font>";
            //$txt_check      = "<font style=\"color:#FF0000\">审</font>";
        }
        if($v['cata_order'] >= $G_big_integer || $v['cata_order'] <= 0) $v['cata_order'] = '';

?>
	<TR class="<?php echo $tr_class; ?>" onmouseover="return chgBg(this, 1);" onmouseout="return chgBg(this, 0);">
		<TD width="30" class="textC"><input type="checkbox" value="<?php echo $aid; ?>" name="item_id[]"></TD>
        
		<TD>&nbsp;<!-- title="<img src='<?php echo $small_image?>'>" --><span title="<?php echo $article_title; ?>" onclick="listTable.edit(this, 'edit_article_title', '<?php echo $aid; ?>')" style="color:<?php echo $v['tcolor'];?>"><?php echo $article_title_cut; ?></span><!-- <a href="<?php echo $preview; ?>?aid=<?php echo $aid; ?>" title="<?php echo $article_title ?>" target="_blank"><?php echo $article_title_cut; ?></a> --></TD>
		

		<TD width="80" align="center" style="text-align: center;">
            <a href="?mod=content&action=moddan&aid=<?php echo $aid; ?>" class="btn_modify fl" title="修改内容">修改</a>
		</TD></TR>
<?php
    }
} else {
?>
<TR class="tr0" onmouseover="return chgBg(this, 1);" onmouseout="return chgBg(this, 0);">
<TD colspan="10">没有或没有找到合适的记录！</td>
</td>
<?php
}
?>
</TBODY>
</TABLE>
<?php
// 分页
$page_info  = $viewvar['record_total'] . '条记录 共' . $viewvar['page_total'] . '页';
$page_list  = get_page_nav($viewvar['page_total']);
?>


</div>

<?php
require($abs_admin_cppath . '/footer.php');
?>